VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   7230
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   14250
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   7230
   ScaleWidth      =   14250
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command7 
      Caption         =   "Righ Low Beam"
      Height          =   495
      Left            =   9360
      TabIndex        =   66
      Top             =   0
      Width           =   1455
   End
   Begin VB.CommandButton Command6 
      Caption         =   "Left Low Beam"
      Height          =   495
      Left            =   7800
      TabIndex        =   65
      Top             =   0
      Width           =   1455
   End
   Begin VB.CommandButton Command5 
      Caption         =   "Left High Beam"
      Height          =   495
      Left            =   6240
      TabIndex        =   64
      Top             =   0
      Width           =   1455
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Command4"
      Height          =   495
      Left            =   4200
      TabIndex        =   63
      Top             =   6480
      Width           =   375
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Righ High Beam"
      Height          =   495
      Left            =   4680
      TabIndex        =   62
      Top             =   0
      Width           =   1455
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Send AOH"
      Height          =   495
      Left            =   3840
      TabIndex        =   61
      Top             =   3480
      Width           =   615
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Auto"
      Height          =   495
      Left            =   3840
      TabIndex        =   59
      Top             =   2880
      Width           =   735
   End
   Begin VB.TextBox HLLowRightInt 
      Height          =   375
      Left            =   7440
      TabIndex        =   48
      Top             =   3720
      Width           =   1815
   End
   Begin VB.TextBox HLHighRightLR 
      Height          =   375
      Left            =   7440
      TabIndex        =   47
      Top             =   1200
      Width           =   1815
   End
   Begin VB.TextBox txtComStopBit 
      Height          =   285
      Left            =   1800
      TabIndex        =   41
      Text            =   "1"
      Top             =   1920
      Width           =   615
   End
   Begin VB.TextBox txtComBauRate 
      Height          =   285
      Left            =   1800
      TabIndex        =   40
      Text            =   "4800"
      Top             =   1560
      Width           =   615
   End
   Begin VB.TextBox txtParityBit 
      Height          =   285
      Left            =   1800
      TabIndex        =   39
      Text            =   "n"
      Top             =   2280
      Width           =   615
   End
   Begin VB.TextBox txtComDataBit 
      Height          =   285
      Left            =   1800
      TabIndex        =   38
      Text            =   "8"
      Top             =   2640
      Width           =   615
   End
   Begin VB.TextBox txtComPort 
      Height          =   285
      Left            =   1800
      TabIndex        =   37
      Text            =   "4"
      Top             =   1200
      Width           =   615
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   5880
      TabIndex        =   31
      Top             =   6120
      Width           =   2415
   End
   Begin VB.TextBox Text2 
      Height          =   405
      Left            =   5880
      TabIndex        =   30
      Top             =   6480
      Width           =   2415
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   5880
      TabIndex        =   29
      Top             =   5760
      Width           =   2415
   End
   Begin VB.CommandButton btnPosition 
      Caption         =   "Position"
      Height          =   375
      Left            =   4920
      TabIndex        =   28
      Top             =   6480
      Width           =   975
   End
   Begin VB.CommandButton btnMovement 
      Caption         =   "Movement"
      Height          =   375
      Left            =   4920
      TabIndex        =   27
      Top             =   6120
      Width           =   975
   End
   Begin VB.CommandButton btnMeasure 
      Caption         =   "Measure"
      Height          =   375
      Left            =   4920
      TabIndex        =   26
      Top             =   5760
      Width           =   975
   End
   Begin VB.CommandButton btnReset 
      Caption         =   "Reset"
      Height          =   375
      Left            =   600
      TabIndex        =   25
      Top             =   6480
      Width           =   855
   End
   Begin VB.CommandButton btnExit 
      Caption         =   "Exit"
      Height          =   375
      Left            =   2280
      TabIndex        =   23
      Top             =   6480
      Width           =   975
   End
   Begin VB.CommandButton btnStop 
      Caption         =   "Stop"
      Height          =   375
      Left            =   1440
      TabIndex        =   22
      Top             =   6480
      Width           =   855
   End
   Begin VB.ListBox Logger 
      Height          =   5130
      Left            =   9480
      TabIndex        =   21
      Top             =   960
      Width           =   4455
   End
   Begin VB.TextBox HLHighLeftInt 
      Height          =   375
      Left            =   4920
      TabIndex        =   20
      Top             =   840
      Width           =   1815
   End
   Begin VB.TextBox HLHighLeftLR 
      Height          =   375
      Left            =   4920
      TabIndex        =   19
      Top             =   1200
      Width           =   1815
   End
   Begin VB.TextBox HLHighLeftUD 
      Height          =   375
      Left            =   4920
      TabIndex        =   18
      Top             =   1560
      Width           =   1815
   End
   Begin VB.TextBox LeftHighBeam 
      Height          =   375
      Left            =   4920
      TabIndex        =   17
      Top             =   1920
      Width           =   1815
   End
   Begin VB.TextBox BooleanLeftHighBeam 
      Height          =   375
      Left            =   4920
      TabIndex        =   16
      Top             =   2280
      Width           =   1815
   End
   Begin VB.TextBox HLLowLeftInt 
      Height          =   375
      Left            =   4920
      TabIndex        =   15
      Top             =   3720
      Width           =   1815
   End
   Begin VB.TextBox HLLowLeftLR 
      Height          =   375
      Left            =   4920
      TabIndex        =   14
      Top             =   4080
      Width           =   1815
   End
   Begin VB.TextBox HLLowLeftUD 
      Height          =   375
      Left            =   4920
      TabIndex        =   13
      Top             =   4440
      Width           =   1815
   End
   Begin VB.TextBox LeftLowBeam 
      Height          =   375
      Left            =   4920
      TabIndex        =   12
      Top             =   4800
      Width           =   1815
   End
   Begin VB.TextBox BooleanLeftLowBeam 
      Height          =   375
      Left            =   4920
      TabIndex        =   11
      Top             =   5160
      Width           =   1815
   End
   Begin VB.TextBox TuDongTang 
      Height          =   375
      Left            =   11280
      TabIndex        =   10
      Top             =   6120
      Width           =   2535
   End
   Begin VB.TextBox BooleanEnd 
      Height          =   375
      Left            =   11280
      TabIndex        =   9
      Top             =   6480
      Width           =   2535
   End
   Begin VB.TextBox HLHighRightUD 
      Height          =   375
      Left            =   7440
      TabIndex        =   8
      Top             =   1560
      Width           =   1815
   End
   Begin VB.TextBox RightHighBeam 
      Height          =   375
      Left            =   7440
      TabIndex        =   7
      Top             =   1920
      Width           =   1815
   End
   Begin VB.TextBox HLHighRightInt 
      Height          =   375
      Left            =   7440
      TabIndex        =   6
      Top             =   840
      Width           =   1815
   End
   Begin VB.TextBox BooleanRightHighBeam 
      Height          =   375
      Left            =   7440
      TabIndex        =   5
      Top             =   2280
      Width           =   1815
   End
   Begin VB.TextBox BooleanRightLowBeam 
      Height          =   375
      Left            =   7440
      TabIndex        =   4
      Top             =   5160
      Width           =   1815
   End
   Begin VB.TextBox RightLowBeam 
      Height          =   375
      Left            =   7440
      TabIndex        =   3
      Top             =   4800
      Width           =   1815
   End
   Begin VB.TextBox HLLowRightUD 
      Height          =   375
      Left            =   7440
      TabIndex        =   2
      Top             =   4440
      Width           =   1815
   End
   Begin VB.TextBox HLLowRightLR 
      Height          =   375
      Left            =   7440
      TabIndex        =   1
      Top             =   4080
      Width           =   1815
   End
   Begin VB.CommandButton btnAutoTest 
      Caption         =   "Auto Test"
      Height          =   495
      Left            =   6600
      TabIndex        =   0
      Top             =   2880
      Width           =   1095
   End
   Begin VB.Frame Frame1 
      Caption         =   "Settings"
      Height          =   2655
      Left            =   240
      TabIndex        =   36
      Top             =   840
      Width           =   3375
      Begin VB.CommandButton btnUpdate 
         Caption         =   "Change Setting"
         Height          =   375
         Left            =   360
         TabIndex        =   58
         Top             =   2160
         Width           =   1455
      End
      Begin VB.Label Label12 
         Caption         =   "COM Data bits"
         Height          =   255
         Left            =   240
         TabIndex        =   46
         Top             =   1800
         Width           =   1335
      End
      Begin VB.Label Label11 
         Caption         =   "COM Parity"
         Height          =   255
         Left            =   240
         TabIndex        =   45
         Top             =   1440
         Width           =   1095
      End
      Begin VB.Label Label10 
         Caption         =   "COM Stop bits"
         Height          =   255
         Left            =   240
         TabIndex        =   44
         Top             =   1080
         Width           =   1335
      End
      Begin VB.Label Label9 
         Caption         =   "COM Baurate"
         Height          =   255
         Left            =   240
         TabIndex        =   43
         Top             =   720
         Width           =   1335
      End
      Begin VB.Label Label7 
         Caption         =   "COM Port"
         Height          =   255
         Left            =   240
         TabIndex        =   42
         Top             =   360
         Width           =   855
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "Information"
      Height          =   6375
      Left            =   9360
      TabIndex        =   50
      Top             =   720
      Width           =   4695
      Begin VB.Label Label15 
         Caption         =   "BooleanEnd"
         Height          =   255
         Left            =   840
         TabIndex        =   52
         Top             =   5880
         Width           =   975
      End
      Begin VB.Label Label14 
         Caption         =   "Counter"
         Height          =   255
         Left            =   960
         TabIndex        =   51
         Top             =   5520
         Width           =   735
      End
   End
   Begin VB.Frame Frame3 
      Caption         =   "Controls"
      Height          =   3495
      Left            =   240
      TabIndex        =   53
      Top             =   3480
      Width           =   3375
      Begin VB.CommandButton btnRelease 
         Caption         =   "Release"
         Height          =   375
         Left            =   360
         TabIndex        =   60
         Top             =   2520
         Width           =   855
      End
      Begin VB.CommandButton btnMoveDown 
         Caption         =   "V"
         Height          =   735
         Left            =   1560
         TabIndex        =   57
         Top             =   1680
         Width           =   375
      End
      Begin VB.CommandButton btnMoveUp 
         Caption         =   "^"
         BeginProperty Font 
            Name            =   "MS Serif"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   735
         Left            =   1560
         TabIndex        =   56
         Top             =   240
         Width           =   375
      End
      Begin VB.CommandButton btnMoveRight 
         Caption         =   ">"
         Height          =   375
         Left            =   2160
         TabIndex        =   55
         Top             =   1200
         Width           =   855
      End
      Begin VB.CommandButton bntMoveLeft 
         Caption         =   "<"
         Height          =   375
         Left            =   480
         TabIndex        =   54
         Top             =   1200
         Width           =   855
      End
   End
   Begin VB.Label Label6 
      Caption         =   "IsMeasured"
      Height          =   375
      Left            =   3840
      TabIndex        =   49
      Top             =   2280
      Width           =   975
   End
   Begin VB.Label Label5 
      Caption         =   "Data Value"
      Height          =   375
      Left            =   3840
      TabIndex        =   35
      Top             =   1920
      Width           =   975
   End
   Begin VB.Label Label2 
      Caption         =   "UD Angle"
      Height          =   375
      Left            =   3840
      TabIndex        =   34
      Top             =   1560
      Width           =   855
   End
   Begin VB.Label Label4 
      Caption         =   "Insentity"
      Height          =   375
      Left            =   3840
      TabIndex        =   33
      Top             =   840
      Width           =   975
   End
   Begin VB.Label Label3 
      Caption         =   "LR Angle"
      Height          =   375
      Left            =   3840
      TabIndex        =   32
      Top             =   1200
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "HEAD LIGHT TESTER"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   360
      TabIndex        =   24
      Top             =   240
      Width           =   3495
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private mobjTmr As APITimer
Dim a As HeadLight2
Dim Rs232Port As New MSComm
'Dim a As HeadLight


Private Sub bntMoveLeft_Click()
    a.SendControlCmd Cmd.MoveLeft
End Sub

Private Sub btnAutoTest_Click()
    WriteLog "AutoTest Clicked"
    a.MSCommPort = CInt(txtComPort.Text)
    a.MSComSettings = txtComBauRate.Text & ", " & txtParityBit.Text & ", " & txtComDataBit.Text & ", " & txtComStopBit.Text
    a.BatDauTimer
    btnAutoTest.Enabled = False
End Sub

Private Sub btnExit_Click()
    Unload Me
End Sub

Private Sub btnMeasure_Click()
    a.SendMeasureStatus
    Sleep 100
    a.GetMeasureStatus
End Sub

Private Sub btnMovement_Click()
    a.SendMovementStatus
    Sleep 100
    a.GetMovementStatus
End Sub

Private Sub btnMoveRight_Click()
    a.SendControlCmd Cmd.MoveRight
End Sub

Private Sub btnMoveUp_Click()
    a.SendControlCmd Cmd.MoveUp
End Sub

Private Sub btnPosition_Click()
    a.SendCurrentPosition
    Sleep 100
    a.GetCurrentPosition
End Sub

Private Sub btnRelease_Click()
    a.Release
End Sub

Private Sub btnReset_Click()
    a.KetThucTimer
    a.ResetAll
End Sub

Private Sub btnStop_Click()
    a.KetThucTimer
    a.SendStop
    btnAutoTest.Enabled = True
End Sub

Private Sub btnUpdate_Click()
    a.MSCommPort = CInt(txtComPort.Text)
    a.MSComSettings = txtComBauRate.Text & ", " & txtParityBit.Text & ", " & txtComDataBit.Text & ", " & txtComStopBit.Text
End Sub

Private Sub Command1_Click()
    a.MayAnhSang_Load
    'a.AutoTest
    a.SendControlCmd Cmd.Auto
        
End Sub

Private Sub Command2_Click()
    a.SendControlCmd Cmd.MeasureStatusGetting
    ''a.GetMeasureStatus
End Sub

Private Sub Command3_Click()
    a.SendControlCmd Cmd.RightHighBeam
End Sub

Private Sub Command5_Click()
    a.SendControlCmd Cmd.LeftHighBeam
End Sub

Private Sub Command6_Click()
    a.SendControlCmd Cmd.LeftLowBeam
End Sub

Private Sub Command7_Click()
 a.SendControlCmd Cmd.RightLowBeam
End Sub

Private Sub Form_Load()
    Set mobjTmr = New APITimer
    On Error Resume Next
    Set a = New HeadLight2
    On Error Resume Next
    Set Rs232Port = Nothing
    Set Rs232Port = New MSComm
    Set a.MSCommObject = Rs232Port
    'Set a = New HeadLight
    Set a.parentForm = Me
    Set frmForm = Me
    Set a.TimerObject = mobjTmr
    
    ' Call timer
    'a.BatDauTimer
End Sub

Private Sub Form_Unload(Cancel As Integer)
    'Set Rs232Port = Nothing
    'Set a.MSCommObject = Nothing
    Set a = Nothing
End Sub
